﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "ui_mainwindow.h"
#include <QMainWindow>
#include <QTextToSpeech>
#include <QThread>
#include <QTimer>
#include "xunfei_aiui.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
public slots:
    void speak();
    void stop();

    void setRate(int);
    void setPitch(int);
    void setVolume(int volume);

    void stateChanged(QTextToSpeech::State state);
    void engineSelected(int index);
    void languageSelected(int language);
    void voiceSelected(int index);

    void localeChanged(const QLocale &locale);

    void read_answer(const QString& content);
    void read_iat(const QString& content);
private slots:
    void on_record_pressed();

    void on_record_released();

    void on_askxunfei_clicked();

    void on_clear_clicked();

private:
    Ui::MainWindow ui;
    QTextToSpeech *m_speech;
    QVector<QVoice> m_voices;

    XunFei_AIUI* AIPartner = nullptr;
//    QThread* wakeup_thread;
    QTimer* timer;
};

#endif // MAINWINDOW_H
